import api from '@/src/api';
import { Modal, message } from 'antd';

/**
 *
 *  @param  portfolioCodeList  产品组id
 *  @param  portfolioCode  产品code
 *  @param  endDate  结束时间
 */

export default async function isHaveNetValue(payload) {
  const res = await api.getNetAssets(payload);

  if (res?.code == 0) {
    return true;
  } else if (res?.code == 1) {
    let title = '';
    if (res?.data?.length > 0) {
      title = `期末日期的单位净值为0。无净值的时间区间为${res?.data[0]}~${res?.data[1]}`;
    } else {
      title = '该产品无净值';
    }
    Modal.info({
      title: title,
      onOk() {},
    });
    return false;
  } else {
    message.error(res?.msg || '获取净值信息失败');
    return false;
  }
}
